Open
Conversation
A blank index.php file in the directory will prevent accessing the directory directly
1. Made WPUF_File_Logger object singleton 2. Logging disabled for debug mode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A new function is introduced where we can log our messages in a specific file. It will help us debug cron jobs, form settings, payment info etc. Calling a simple function
wpuf_log( $message )will do the trick. It will store a log with the current date time in thewp-content/uploads/wpuf-logs/directory. A new log file will be created for each day and all the log files older than 60 days will be removed.How to use
Simply calling
wpuf_log( $message )will store the log message with datetime. This function also have 2 others optional parameter to pass. So the three parameters are:$message [string]
The message to log
$level [string]
The log level. Default
info$log_file [string|resource]
Optional parameter to pass the log file. The log will be written in this file instead of the default log file.
A basic use:
Will store a log message like:
Hooks Introduced
wpuf_log_directory[filter]: The default log directory iswp-content/uploads/wpuf-logs/. We can change it using this filter.wpuf_log_file_name[filter]: We can change the log file name entirely using this filter.wpuf_formatted_log_message[filter]: The default log format is[%datetime%] %level%: %message%\n. With this filter we will get the formatted log message.wpuf_logger_expiration_days[filter]: Log file will be deleted after 60 days. We can change it using this filter.